package cn.wbnyua.msm.web.dao;

import cn.wbnyua.msm.web.domain.Goods;
import cn.wbnyua.msm.web.domain.Member;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 作者：wbnyua.
 * 创建时间: 2023/2/8 22:56.
 */

@Mapper
public interface MemberMapper {
    @Select("select * from member")
    List<Member> findAll();
    @Select("select * from member where id = #{id}")
    Member findById(Long id);

    @Insert("INSERT INTO `msm`.`member` (`card_num`, `name`, `birthday`, `mobile`, `integral`, `money`, `pay_type`, `address`)" +
            " VALUES (#{cardNum}, #{name}, #{birthday}, #{mobile}, #{integral}, #{money}, #{payType}, #{address})")
    int add(Member member);

    @Update("UPDATE `msm`.`member` SET `card_num` = '#{cardNum}'," +
            " `name` = '#{name}', `birthday` = '#{birthday}', `mobile` = '#{mobile}," +
            " `integral` = '#{integral}', `money` = '#{money}', `pay_type` = '#{payType}'," +
            " `address` = '#{address}' WHERE `id` = #{id}")
    int update(Member member);

    @Delete("delete from member where id = #{id}")
    int remove(Long id);
}
